package lab02.test36;

import java.util.Scanner;

/**
 * Created by 123 on 2017/12/29.
 */
public class StudentDemo {
    public static void main(String[] args) {
        Student[] students = new Student[5];
        while (true) {
            System.out.println("请输入学生学历：");
            Scanner scanner = new Scanner(System.in);
            String level = scanner.nextLine();
            if (level.equals("研究生")) {
                for (int i = 0; i < 1; i++) {
                    students[i] = new Graduate();
                    students[i].course = new double[3];
                    System.out.println("请输入研究生名字：");
                    Scanner scanner1 = new Scanner(System.in);
                    students[i].name = scanner1.nextLine();
                    for (int j = 0; j < students[i].course.length; j++) {
                        System.out.println("请输入研究生成绩：");
                        Scanner scanner2 = new Scanner(System.in);
                        students[i].course[j] = scanner2.nextDouble();
                    }
                    System.out.print("该" + level + "\t" + students[i].name + "\t");
                    System.out.println(students[i].average(students[i].course));
                }
            } else  if (level.equals("本科生")) {
                for (int i = 0; i < 1; i++) {
                    students[i] = new UnderGraduate();
                    students[i].course = new double[3];
                    System.out.println("请输入本科生名字：");
                    Scanner scanner1 = new Scanner(System.in);
                    students[i].name = scanner1.nextLine();
                    for (int j = 0; j < students[i].course.length; j++) {
                        System.out.println("请输入本科生成绩：");
                        Scanner scanner2 = new Scanner(System.in);
                        students[i].course[j] = scanner2.nextDouble();
                    }
                    System.out.print("该" + level + "\t" + students[i].name + "\t");
                    System.out.println(students[i].average(students[i].course));
                }
            }else System.out.println("没有这种学历，请检查你的输入！！！");
        }
    }

}
